<template>
  <div class="jiankong">
    <div class="jiankong_cont">
      <!-- 筛选 -->
      <div class="jiankong_cont_search">
        <div class="dropdown mgr-20">
          <el-select
            @change="selectStreet('street')"
            placeholder="选择街办"
            v-model="street"
          >
            <el-option
              :key="item.value"
              :label="item.label"
              :value="item.label"
              v-for="item in source.streetList"
            ></el-option>
          </el-select>
        </div>
        <div class="dropdown">
          <el-select
            @change="selectStreet()"
            placeholder="选择社区"
            v-model="community"
          >
            <el-option
              :key="item.value"
              :label="item.label"
              :value="item.label"
              v-for="item in source.communityList"
            ></el-option>
          </el-select>
        </div>
        <!-- <div class="search">
          <el-input
            placeholder="请输入点位名称"
            prefix-icon="el-icon-search"
            v-model="pointName"
          ></el-input>
          <el-button @click="search" type="primary">确定</el-button>
        </div> -->
      </div>

      <div class="page-box">
        <div class="flex-left">
          <bujian-list :list="list" @change="paramChange"></bujian-list>
        </div>
        <div v-show="visible" class="flex-right">
          <bujian-detail
            ref="bujianDetail"
            :isShowLaw="isShowLaw"
            @changeVisible="toggleVisible"
          ></bujian-detail>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Bus from "@/untils/bus";
import { queryBjMapStreetList, queryBjMapCommunityList } from "@/api/index.js"; //api
import bujianList from "./components/bujianList";
import bujianDetail from "./components/bujianDetail";
export default {
  components: {
    bujianList,
    bujianDetail,
  },
  data() {
    return {
      street: "",
      community: "",
      pointName: "",
      // 子组件 返回参数
      SubObj: {
        type: "", // 部件类别
        isShowLaw: false, // 显示案件
      },
      isShowLaw: false,
      source: {
        streetList: [],
        communityList: [],
        typeList: [],
      },
      list: [],
      visible: false,
      detailInfo: {},
    };
  },
  mounted() {
    // this.getList()
    this.getStreet();
    this.getCommunity();
  },
  beforeDestroy() {},
  methods: {
    // 筛选条件
    search() {
      this.SubObj.type = "";
      this.SubObj.isShowLaw = true;
      // this.getList()
    },
    // 选择街办,社区
    selectStreet(type) {
      if (type == "street") {
        // 选择街办
        this.community = "";
        this.source.communityList = [];
        this.getCommunity();
      } else {
        // 选择社区
        Bus.$emit("bujianMapUpdateArea", {
          street: this.street,
          community: this.community,
        });
      }
    },
    // 街办列表
    getStreet() {
      //获取街道办内容
      queryBjMapStreetList().then((res) => {
        this.source.streetList = (res || []).map((item) => {
          return {
            value: item.street,
            label: item.street,
          };
        });
        this.getCommunity();
      });
    },
    // 社区列表
    getCommunity() {
      //获取社区
      queryBjMapCommunityList({
        street: this.street,
      }).then((res) => {
        this.source.communityList = (res || []).map((item) => {
          return {
            value: item.community,
            label: item.community,
          };
        });
      });
    },

    // 列表组件
    paramChange(data) {
      this.SubObj = data;
      this.isShowLaw = data.isShowLaw;
    },

    toggleVisible(visible) {
      this.visible = visible;
    },
  },
};
</script>

<style lang="less">
.mgr-20 {
  margin-right: 20px;
}
.jiankong {
  width: 100%;
  // height: 1020px;
  // background-image: url(../../assets/images/jiankong/jiankongbg.png);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1001;
  .jiankong_cont {
    height: calc(100% - 80px);
    // background-image: url(../../assets/images/jiankong/jk-bg.png);
    background-size: 98% 99%;
    background-position-x: center;
    background-position-y: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    padding: 0 1%;
    // background: linear-gradient(to bottom, #000217, #17253c);

    .jiankong_cont_search {
      display: flex;
      justify-content: center;
      .dropdown {
        .el-input .el-input__inner {
          width: 150px;
          background: #173c90;
          border: none;
        }
      }

      .search {
        width: 430px;
        margin-left: 20px;
        background: #173c90;
        border-radius: 5px;
        display: flex;
        justify-content: center;
        padding-left: 10px;
        .el-input .el-input__inner {
          width: 320px;
          background: none;
          border: none;
          color: white;
          caret-color: white;
        }
        .el-button {
          width: 100px;
          background: #16cefc;
        }
      }
    }

    .monitor {
      flex: 1;
      overflow: hidden;
      margin-top: 30px;
    }

    .videoUl {
      // margin-top: 15px;

      .videoItem {
        cursor: pointer;
        width: 31%;
        margin-top: 20px;
        margin-right: 1%;
        text-align: center;
        overflow: hidden;
        padding: 28px;
        height: 365px;
        background-image: url(../../assets/images/jiankong/jk-item-bg.png);
        background-size: 100% 100%;
        background-repeat: no-repeat;
        border: none;
        -webkit-box-shadow: none;
        position: relative;
        .video {
          width: 100%;
          height: 280px;
        }
        .jynPlayers {
          height: 280px;
        }

        p {
          font-size: 16px;
          font-family: Source Han Sans SC;
          font-weight: bold;
          color: #feffff;
          margin-top: 8px;
        }
      }
      .jynVideo {
        position: relative;

        .cover-picture {
          position: absolute;
          width: 100%;
          height: 100%;
          top: 0;
          left: 0;
          z-index: 1002;
          img {
            display: block;
            width: 100%;
            height: 100%;
          }
        }
      }
      .videoItem:nth-child(4n + 4) {
        // margin-right: 0;
      }
    }

    // .el-pagination button:disabled{
    //     background: none;
    //     color: #FFFFFF;
    // }
    .videopage {
      margin: 30px 0;
    }

    .el-pager li {
      background: none;
      color: #ffffff;
    }

    .el-pager li.active {
      color: #409eff !important;
    }

    .el-pagination .btn-next,
    .el-pagination .btn-prev {
      background: none;
    }
    .el-pagination__total {
      color: white;
    }
    .el-pagination__jump {
      color: white;
    }

    .el-pagination .btn-next .el-icon,
    .el-pagination .btn-prev .el-icon {
      color: #ffffff;
    }
  }

  // 弹窗
  .jkfix {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;

    .jkfix1 {
      width: 60%;
      height: 70%;
      background-color: #0e3154;
      border-radius: 8px;
      display: flex;
      flex-direction: column;

      .fixtitle {
        height: 60px;
        font-size: 18px;
        padding: 0 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;

        .ft,
        .fclose {
          color: #fff !important;
        }
      }

      .fixbox {
        flex: 1;
        height: 0;

        .fixboxvideo {
          height: 100%;
        }
      }
    }
  }
}
.jiankong .page-box .flex-left {
  background: url("../../assets/images/bujianMap/bg-1.png") no-repeat 0 0;
  background-size: 100% 100%;
  width: 390px;
}
.jiankong .page-box .flex-right {
  background: url("../../assets/images/bujianMap/bg-1.png") no-repeat 0 0;
  background-size: 100% 100%;
  width: 390px;
}
</style>